package newspaperSystem;



import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Leo
 */
public class Delete extends javax.swing.JFrame implements ActionListener{

    /**
     * Creates new form Delete
     */
    private ButtonGroup bg = new ButtonGroup();
    
    public Delete() {
        initComponents();
        
            bg.add(jRadioButton1);
            bg.add(jRadioButton2);
            bg.add(jRadioButton3);
            bg.add(jRadioButton4);
            bg.add(jRadioButton5);
            bg.add(jRadioButton6);
            bg.add(jRadioButton7);
        
            jRadioButton1.addActionListener(this);
            jRadioButton2.addActionListener(this);
            jRadioButton3.addActionListener(this);
            jRadioButton4.addActionListener(this);
            jRadioButton5.addActionListener(this);
            jRadioButton6.addActionListener(this);
            jRadioButton7.addActionListener(this);
            
            jButton1.addActionListener(this);
            jButton2.addActionListener(this);
            jButton3.addActionListener(this);
            jButton4.addActionListener(this);
            jButton5.addActionListener(this);
            jButton8.addActionListener(this);
            jButton7.addActionListener(this);
            jButton10.addActionListener(this);
            jButton9.addActionListener(this);
            
  
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jRadioButton3 = new javax.swing.JRadioButton();
        jRadioButton4 = new javax.swing.JRadioButton();
        jRadioButton5 = new javax.swing.JRadioButton();
        jRadioButton6 = new javax.swing.JRadioButton();
        jRadioButton7 = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
        jLabel1.setText("Delete Data");

        jRadioButton1.setText("Carriers");

        jRadioButton2.setText("Customers");

        jRadioButton3.setText("Suppliers");

        jRadioButton4.setText("Subscription");

        jRadioButton5.setText("Bill");

        jRadioButton6.setText("Routes");

        jRadioButton7.setText("Product");

        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        jScrollPane1.setViewportView(jTextArea1);

        jLabel2.setText("Enter Id of the field to delete:");

        jButton3.setText("search");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel3.setText("Click 1 table button to delete record  ");

        jToolBar1.setRollover(true);

        jButton1.setText("Carrier");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton1);

        jButton5.setText("Customer");
        jButton5.setFocusable(false);
        jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton5);

        jButton10.setText("Suppliers");
        jButton10.setFocusable(false);
        jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton10);

        jButton7.setFocusable(false);
        jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton7.setLabel("Subscription");
        jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton7);

        jButton9.setText("Routes");
        jButton9.setFocusable(false);
        jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton9);

        jButton4.setText("Product");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton4);

        jButton8.setText("Bill");
        jButton8.setFocusable(false);
        jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton8);

        jButton2.setText("Back");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(230, 230, 230))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton7)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButton1)
                                    .addComponent(jRadioButton3)
                                    .addComponent(jRadioButton5))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jRadioButton6)
                                    .addComponent(jRadioButton4)
                                    .addComponent(jRadioButton2)))
                            .addComponent(jLabel2)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(9, 9, 9)
                                .addComponent(jButton3)))
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(129, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addGap(0, 0, Short.MAX_VALUE))))
            .addGroup(layout.createSequentialGroup()
                .addGap(332, 332, 332)
                .addComponent(jButton2)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton1)
                            .addComponent(jRadioButton2))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton3)
                            .addComponent(jRadioButton4))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jRadioButton6)
                            .addComponent(jRadioButton5, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jRadioButton7)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton3)))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(48, 48, 48)
                .addComponent(jButton2)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Delete().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JRadioButton jRadioButton3;
    private javax.swing.JRadioButton jRadioButton4;
    private javax.swing.JRadioButton jRadioButton5;
    private javax.swing.JRadioButton jRadioButton6;
    private javax.swing.JRadioButton jRadioButton7;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables

    @Override
    public void actionPerformed(ActionEvent e) {
        
                Locale loc = Locale.getDefault();
		ResourceBundle bundle = ResourceBundle.getBundle("database",loc);
                String url = bundle.getString("URL");
                String user = bundle.getString("username");
         	String pw = bundle.getString("password");
                String driver = bundle.getString("Driver");  
                Connection conn = null;
                Statement stmt = null;
                
                //PreparedStatement pstmnt;
                
                ResultSet resultSet =null;
       
            try{
            
                 Class.forName(driver);
                 System.out.println("Driver loaded succesfully!!!");
              
            } catch(ClassNotFoundException classNotFound){
                
                System.out.println("OOps class not found:"+classNotFound);
            }
               
            try{
                   
                   conn = DriverManager.getConnection(url, user, pw); 
                  
                   System.out.println("Connection successful");
                   stmt = conn.createStatement();
                   
            try{
                
               if(e.getSource()==jRadioButton7){
                   
                String query3 = "Select* from Product";
               
                resultSet = stmt.executeQuery(query3);
                                
            
            if(resultSet!=null)
                jTextArea1.setText("Product Id\tSubscription Id\tProduct descr\tProduct Price\n");
                jTextArea1.append("=============================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\n");
                 
                }
        }
        if(e.getSource()==jButton2){
           this.dispose();
        }
        else if(e.getSource()==jRadioButton1){
        
            String query = "Select* from Carriers";
         
                resultSet = stmt.executeQuery(query);
                  
              if(resultSet!=null)
               jTextArea1.setText("Carrier Id\tName\tSurname\tPhone Number\tAddress\tSurbab\n");
               jTextArea1.append("=====================================================================\n");
               
                while(resultSet.next()){
                            
               jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\t"+resultSet.getString(5)+"\t"+resultSet.getString(6)+"\n");
              }
        
        }
        if(e.getSource()==jRadioButton2){
        
        String query2 = "Select* from Customer";
           resultSet = stmt.executeQuery(query2);
        
           if(resultSet!=null)
               jTextArea1.setText("Customer Id\tCustomer name    Phone Number\tAddress\n");
               jTextArea1.append("============================================================\n");
           
            while(resultSet.next()){
                     
           jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t  "+resultSet.getString(3)+"\t\t"+resultSet.getString(4)+"\n");
       }
        }
        else if(e.getSource()==jRadioButton4){
        
            String query4 = "Select* from Subscription";
            resultSet = stmt.executeQuery(query4);
                     
            if(resultSet!=null)
                jTextArea1.setText("Subscription Id\tCustomer Id\tType\tDescription\n");
                jTextArea1.append("=========================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t"+resultSet.getString(4)+"\n");
                }
       
        }
        else if(e.getSource()==jRadioButton6){
        
            String query5 = "Select* from Routes";
            resultSet = stmt.executeQuery(query5);
                     
            if(resultSet!=null)
                jTextArea1.setText("Route Number\tRoute Name\tRoute description\tRoute Address\n");
                jTextArea1.append("===============================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t"+resultSet.getString(3)+"\t\t"+resultSet.getString(4)+"\n");
                }
         
        }
        else if(e.getSource()==jRadioButton5){
        
             String dispQuery = "Select* from Bill";
             resultSet = stmt.executeQuery(dispQuery);
                     
            if(resultSet!=null)
             jTextArea1.setText("Customer Id\tCustomer Name\tSubscription Type\tAmount\n");
             jTextArea1.append("=====================================================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t"+resultSet.getString(2)+"\t\t"+resultSet.getString(3)+"\t\t"+resultSet.getString(4)+"\n");
                }
        
        }
        else if(e.getSource()==jRadioButton3){
        
             String query7 = "Select* from Suppliers";
             resultSet = stmt.executeQuery(query7);
                     
            if(resultSet!=null)
                jTextArea1.setText("Supplier Name \t\tDate\n");
                jTextArea1.append("========================================\n");
                while(resultSet.next()){
                    
                    jTextArea1.append(resultSet.getString(1)+"\t\t"+resultSet.getString(2)+"\n");
                    
                }
        }
        if(e.getSource()==jButton3){    
           String sql  = "Select * from Carriers";
           String sql2 = "Select * from Customer";
           String sql3 = "Select * from Product";
           String sql4 = "Select * from Bill";
           String sql5 = "Select * from Routes";
           String sql6 = "Select * from Suppliers";
           String sql7 = "Select * from Subscription";
           
           String deleteSearch = jTextField1.getText();
           ResultSet rs;
           ResultSet rs2;
           ResultSet rs3;
           ResultSet rs4;
           ResultSet rs5;
           ResultSet rs6;
           ResultSet rs7;
           
           rs = stmt.executeQuery(sql);
           while(rs.next()){
            if(deleteSearch.equalsIgnoreCase(rs.getString(1))){
               
                JOptionPane.showMessageDialog(null, "This user or item exist choose & press button below to delete");
                
            }
            
         }
          
           rs2 = stmt.executeQuery(sql2);
           while(rs2.next()){
            if(deleteSearch.equalsIgnoreCase(rs2.getString(1))){
               
                
                 JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
            }
        }
           rs3 = stmt.executeQuery(sql3);
           while(rs3.next()){
            if(deleteSearch.equalsIgnoreCase(rs3.getString(1))){
               
                JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
              
            }
           }
           rs4 = stmt.executeQuery(sql4);
           while(rs4.next()){
            if(deleteSearch.equalsIgnoreCase(rs4.getString(1))){
               
             
           JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
            }
         
           }
           
           rs5 = stmt.executeQuery(sql5);
           while(rs5.next()){
            if(deleteSearch.equalsIgnoreCase(rs5.getString(1))){
               
               
                 JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
            }
           }
           
           rs6 = stmt.executeQuery(sql6);
           while(rs6.next()){
            if(deleteSearch.equalsIgnoreCase(rs6.getString(1))){
               
                 JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
       
            }
           }
          rs7 = stmt.executeQuery(sql7);
           while(rs7.next()){
            if(deleteSearch.equalsIgnoreCase(rs7.getString(1))){
               
                 JOptionPane.showMessageDialog(null,"This user or item exist choose & press button below to delete");
            }
           
        }
        }
       if(e.getSource()==jButton1){
                
          
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Carriers where Carrier_Id ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"User Deleted");
                jTextField1.setText("");
         }

       if(e.getSource()==jButton5){
                
           
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Customer where Cust_Id ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"User Deleted");
                jTextField1.setText("");
        }
       
       if(e.getSource()==jButton10){
                
           
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Suppliers where Supp_Name ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"Item Deleted");
                jTextField1.setText("");
        }
       
       if(e.getSource()==jButton7){
               
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Subscription where Subscr_Id ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"Item Deleted");
                jTextField1.setText("");
        }
       
       if(e.getSource()==jButton9){
                
           
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Routes where Route_Num ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"Item Deleted");
                jTextField1.setText("");
        }
       
       if(e.getSource()==jButton4){
                
           
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Product where Prod_Id ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"Item  Deleted");
                jTextField1.setText("");
        }
       
       if(e.getSource()==jButton8){
                
           
                String deleteSearch = jTextField1.getText();
                
                String sqlDel1 = "Delete  from Bill where Cust_Id ='"+(deleteSearch)+"'";
                stmt.executeUpdate(sqlDel1);
                JOptionPane.showMessageDialog(null,"User Deleted");
                jTextField1.setText("");
        }
       }
            
           catch(Exception exa){
            System.out.println("");
        }
    }
    catch(Exception exa){
            System.out.println("");
        }
            
            finally{
                
                try{
                    if(resultSet!=null){
                    resultSet.close();
                    }
                    if(stmt!=null)
                    {stmt.close();}
                    if(conn!=null){
                    conn.close();}
                  
                }catch(Exception exception){
                    System.out.println("Something went wrong along the way");
                }
                  }
    }
}
